package com.example.mvc.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
@RequestMapping("/springmvc")
public class SpringMVCTest {

    private static final String SUCCESS = "success";

    // ant path ant风格路径映射

    // 映射http请求参数、请求头
    @RequestMapping(path = "/testParamsAndHeader",
            params = {"username", "age!=10"},headers = {"accept-language=zh-CN,zh;q=0.9"})
    public String testParamsAndHeader() {
        return SUCCESS;
    }

    // 映射http请求方式
    @RequestMapping(path = "/testMethod", method = RequestMethod.POST)
    public String testMethod() {
        return SUCCESS;
    }

    @RequestMapping("/testRequestMapping")
    public String testRequestMapping() {
        return SUCCESS;
    }
}
